package com.changgou.business.controller;

import com.changgou.business.service.ConfigService;
import com.changgou.entity.Result;
import com.changgou.entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

//sys_config表的增删改查
@RestController
@CrossOrigin
@RequestMapping("/config")
public class ConfigController {

    @Autowired
    private ConfigService configService;

    /**
     * 到期时间查询
     * @return
     */
    @GetMapping(value = "/endTime" )
    public Result<List<String>> getAddress(){
        try {
            List<String> endTimes = configService.getEndTime();
            return new Result(true, StatusCode.OK,"查询到期时间成功",endTimes);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false,StatusCode.ERROR,"查询到期时间失败");
        }
    }
}
